package edu.unindra.raport.dao.koneksi;

import java.sql.Connection;
import java.sql.DriverManager;

public class DatabaseUtilities {
	private static final String DRIVER = "com.mysql.jdbc.Driver";

	private static DatabaseUtilities resource = null;
	private Connection connection = null;

	private DatabaseUtilities() throws Exception {
		String userName = "root";
		String password = "5678";

		Class.forName(DRIVER);

		String url = "jdbc:mysql://localhost:3306/raport";
		connection = DriverManager.getConnection(url, userName, password);
	}

	public static DatabaseUtilities getInstance() throws Exception {
		if (resource == null) {
			resource = new DatabaseUtilities();
		}
		return resource;
	}

	public Connection getConnection() {
		return connection;
	}

	public void setConnection(Connection connection) {
		this.connection = connection;
	}

}
